<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">

            <h:form id="configForm" enctype="multipart/form-data">
                <div style="width: 100%;margin-bottom: 40px;float: left">
                <h3 class="title" style="float: left">Configuração</h3>
                <p:commandButton value="Adicionar Parametro" icon="ui-icon-plusthick"
                                 update="@form"
                                 process="@form"
                                 immediate="true"
                                 style="float: right;margin-right: 15px"
                                 actionListener="#{managerConfiguracao.add()}"
                                 />
                </div>
                <p:growl id="messages" showDetail="true" autoUpdate="true"  /> 
                <div class="row">
                    <div class="twelve columns"> 
                            <p:panel id="configpanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">
                                <ui:repeat value="#{managerConfiguracao.config.parametros}" var="entry">
                                    <div class="grid_23">
                                        <p:outputLabel value="Nome" styleClass="grid_2" />
                                        <p:inputText value="#{entry.name}" styleClass="grid_6"  />
                                        <p:outputLabel value="Valor" styleClass="grid_2" />
                                        <p:inputText value="#{entry.valor}" styleClass="grid_12" />
                                        <p:commandButton icon="ui-icon-close" actionListener="#{managerConfiguracao.remove(entry)}"
                                                         update="@form" immediate="true" title="Remover" />
                                        <br/>
                                    </div>
                                </ui:repeat> 
                                <div class="buttonAction" style="margin-top: 30px;float: left;text-align: center;width: 100%">
                                    <p:commandButton value="Salvar" 
                                                     actionListener="#{managerConfiguracao.salvar()}"
                                                     update="@form"
                                                     icon="ui-icon-disk"
                                                     styleClass="ui-priority-primary" />
                                    <p:button href="indexuser.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                                </div >


                            </p:panel>
                        <br/>
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
